<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 吕旺平
  Date: 2019/10/29
  Time: 9:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
	<title>用户编辑</title>
	<c:import url="/layout/_imports.jsp"></c:import>
</head>
<body>
<c:import url="/layout/_nav.jsp"></c:import>
<div class="container">
	<h2>编辑用户</h2>

	<form action="/user" method="post">
		<input type="hidden" name="state" value="update">
		<input type="hidden" name="id" value="${u.id}">

		<div class="form-group row">
			<label class="col-sm-2" for="UserName">用户名</label>
			<div class="col-sm-10">
				<input class="form-control" id="UserName" type="text" name="username" value="${u.username}" readonly>
			</div>
		</div>

		<div class="form-group row">
			<label for="Email" class="col-sm-2">email</label>
			<div class="col-sm-10">
				<input class="form-control" id="Email" type="text" name="email" value="${u.email}">
			</div>
		</div>

		<div class="form-group row">
			<label for="Name" class="col-sm-2">姓名</label>
			<div class="col-sm-10">
				<input class="form-control" id="Name" type="text" name="name" value="${u.name}">
			</div>
		</div>

		<div class="form-group row">
			<label for="Mobile" class="col-sm-2">手机号</label>
			<div class="col-sm-10">
				<input class="form-control" id="Mobile" type="text" name="mobile" value="${u.mobile}">
			</div>
		</div>

		<div class="form-group row">
			<label class="col-sm-2">性别</label>
			<div class="col-sm-10">
				<select class="form-control" name="sex">
					<option value="1" <c:if test="${u.sex == 1}">selected</c:if>>男</option>
					<option value="0" <c:if test="${u.sex == 0}">selected</c:if>>女</option>
					<option value="2" <c:if test="${u.sex == 2}">selected</c:if>>保密</option>
				</select>
			</div>
		</div>

		<div class="form-group row">
			<label class="col-sm-2">管理员</label>
			<div class="col-sm-10">
				<select class="form-control" name="admin">
					<option value="True" <c:if test="${u.isAdmin == true}">selected</c:if>>True</option>
					<option value="False" <c:if test="${u.isAdmin == false}">selected</c:if>>False</option>
				</select>
			</div>
		</div>

		<button type="submit" class="btn btn-primary">保存</button>
		<a href="/user?state=manage" class="btn btn-secondary">返回列表</a>
</form>
</div>
</body>
</html>
